package com.song.dao;

import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.mapping.StatementType;
import org.apache.ibatis.session.ExecutorType;

import java.util.List;
import java.util.Map;


/**
 * @Description: SequenceDao：类描述
 * @author: songzhangyong
 * @Date: 2019/11/9 10:58
 */

@CacheNamespace
public interface SequenceDao {

    @Select(" select * from mybatis_test ")
//    @SelectProvider()
    List<UserInfo> query();

    @Select(" select * from mybatis_test where id = #{id}")
//    @Options(statementType = StatementType.PREPARED)
    UserInfo queryById(@Param("id") int id );

    @Select(" select * from mybatis_test where id = #{id} and 1 =1 ")
    @Options(flushCache = true)
    UserInfo queryById2(@Param("id") int id );


    @Insert(" insert into mybatis_test(name, age) values (#{name}  , #{age} )")
    void insert(@Param("name") String name , @Param("age") int age );


    @Update(" update mybatis_test set name = #{name} where id = #{id}")
    void updateName(@Param("name") String name , @Param("id") int id );


    @Update(" update mybatis_test set age = #{age} where id = #{id}")
    void updateAge(@Param("age") int age , @Param("id") int id );


    @Delete(" delete from mybatis_test where id = #{id}")
    void deleteById( @Param("id") int id );



}
